//
//  ViewController.m
//  ZYDrawString
//
//  Created by mac on 2018/8/21.
//  Copyright © 2018年 ZY. All rights reserved.
//

#import "ViewController.h"

#import "InputFontViewController.h"
#import "ZYMainViewController.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self createUI];
}

-(void)createUI
{
    NSArray *buttons = @[@"写字动画",@"打字动画"];
    for (NSInteger i = 0; i < buttons.count; ++i) {
        UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
        [self.view addSubview:button];
        [button setTitle:buttons[i] forState:UIControlStateNormal];
        [button setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
        button.titleLabel.font = [UIFont systemFontOfSize:15];
        [button addTarget:self action:@selector(buttonAction:) forControlEvents:UIControlEventTouchUpInside];
        button.tag = i;
        [button mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerX.mas_equalTo(self.view.mas_centerX).mas_offset(0);
            make.top.mas_equalTo(self.view.mas_top).mas_offset(64 + 20 + (i * 40 + 20));
            make.width.mas_equalTo(100);
            make.height.mas_equalTo(40);
        }];
    }
    
}

-(void)buttonAction:(UIButton *)sender
{
    switch (sender.tag) {
        case 0:
        {
            ZYMainViewController *vc = [[ZYMainViewController alloc] init];
            vc.navigationItem.title = sender.titleLabel.text;
            [self.navigationController pushViewController:vc animated:YES];
        }
            break;
        case 1:
        {
            InputFontViewController *inputFontVC = [[InputFontViewController alloc] init];
            inputFontVC.navigationItem.title = sender.titleLabel.text;
            [self.navigationController pushViewController:inputFontVC animated:YES];
        }
            break;
            
        default:
            break;
    }
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
